package com.nbsaas.boot.order.rest.resource;

import com.nbsaas.boot.order.api.apis.OrderReviewApi;
import com.nbsaas.boot.order.data.entity.OrderReview;
import com.nbsaas.boot.order.api.domain.request.OrderReviewRequest;
import com.nbsaas.boot.order.api.domain.response.OrderReviewResponse;
import com.nbsaas.boot.order.api.domain.simple.OrderReviewSimple;
import com.nbsaas.boot.order.rest.convert.OrderReviewSimpleConvert;
import com.nbsaas.boot.order.rest.convert.OrderReviewEntityConvert;
import com.nbsaas.boot.order.rest.convert.OrderReviewResponseConvert;
import com.nbsaas.boot.order.data.repository.OrderReviewRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   订单评价-业务接口实现
*/
@Transactional
@Service
public class OrderReviewResource extends BaseResource<OrderReview,OrderReviewResponse, OrderReviewSimple, OrderReviewRequest>  implements OrderReviewApi {

    @Resource
    private OrderReviewRepository orderReviewRepository;

    @Override
    public JpaRepositoryImplementation<OrderReview, Serializable> getJpaRepository() {
        return orderReviewRepository;
    }

    @Override
    public Function<OrderReview, OrderReviewSimple> getConvertSimple() {
        return new OrderReviewSimpleConvert();
    }

    @Override
    public Function<OrderReviewRequest, OrderReview> getConvertForm() {
        return new OrderReviewEntityConvert();
    }

    @Override
    public Function<OrderReview, OrderReviewResponse> getConvertResponse() {
        return new OrderReviewResponseConvert();
    }




}


